<title>设置我的资料</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>设置</cite></a>
        <a><cite>我的资料</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">设置我的资料</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list">
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="userID" value='' readonly class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">不可修改。一般用于后台登入名</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机</label>
                            <div class="layui-input-inline">
                                <input type="text" name="mobile" value="" readonly class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">不可修改。</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">昵称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="userName" value="" lay-verify="nickname" autocomplete="off" placeholder="请输入昵称" class="layui-input">
                            </div>
                        </div>
                        <!--<div class="layui-form-item">
                            <label class="layui-form-label">性别</label>
                            <div class="layui-input-block">
                                <input type="radio" name="sex" value="0" title="男">
                                <input type="radio" name="sex" value="1" title="女">
                            </div>
                        </div>-->
                        <!--<div class="layui-form-item">
                            <label class="layui-form-label">头像</label>
                            <div class="layui-input-inline">
                                <script type='text/html' template lay-done='layui.data.setUpload(d);'>
                                <input name="Photo_Upload" lay-verify="required" id="LAY_avatarSrc" placeholder="图片地址" value="" class="layui-input">
                                    </script>
                            </div>
                            <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                <button type="button" class="layui-btn layui-btn-primary" id="LAY_avatarUpload">
                                    <i class="layui-icon">&#xe67c;</i>上传图片
                                </button>
                                <button class="layui-btn layui-btn-primary"
                                    layadmin-event="Photo_UploadImg">查看图片</button>
                            </div>
                        </div>-->
                        <div class="layui-form-item">
                            <label class="layui-form-label">邮箱</label>
                            <div class="layui-input-inline">
                                <input type="text" name="email" value="" lay-verify="email" autocomplete="off"
                                    class="layui-input">
                            </div>
                        </div>
                        <!--<div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="Remark" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>-->
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="setmyinfo">确认修改</button>
                                <!--<button type="reset" class="layui-btn layui-btn-primary">重新填写</button>-->
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use('set', function () {
        var admin = layui.admin;
        var form = layui.form;
        admin.req({
            url: layui.setter.APIUrl + '/admin/getLoginUser' //实际使用请改成服务端真实接口
            , type: "post"
            , done: function (res) {
                form.val("layuiadmin-app-form-list", res.Data);
            }
        });
    });


    layui.data.setUpload = function (d) {
        layui.use(['upload', 'admin'], function () {
            var $ = layui.$,
                upload = layui.upload,
                admin = layui.admin;
            var formSelects = layui.formSelects;

            var Photo_UploadSrc = $('#LAY_avatarSrc');
            upload.render({
                url: '/WebAPI/file/uploadImg/'
                , elem: '#LAY_avatarUpload'
                , accept: 'images'
                , method: 'get'
                , multiple: true
                , acceptMime: 'image/*'
                , done: function (res) {
                    if (res.ResultCode == 0) {
                        Photo_UploadSrc.val(res.Data.src);
                        layer.msg('上传成功');
                    } else {
                        layer.msg(res.msg);
                    }
                }
            });

            //查看图片
            admin.events.Photo_UploadImg = function (othis) {
                var src = Photo_UploadSrc.val();
                layer.photos({
                    photos: {
                        "title": "查看头像", //相册标题
                        "data": [{
                            "src": src //原图地址
                        }]
                    }
                    , shade: 0.01
                    , closeBtn: 1
                    , anim: 5
                });
            };

        });
    };


</script>